import request from '@/utils/request'

// 对应接口的列表接口index
export function fetchNewsList(query) {
  return request({
    url: '/news/list',
    method: 'post',
    params: query
  })
}

// 对应接口的列表接口index
export function fetchHomeNewsList(data) {
  return request({
    url: '/news/shouyelist',
    method: 'post',
    data
  })
}

// 对应接口的详情接口show
export function fetchNews(id) {
  return request({
    url: `/news/${id}`,
    method: 'get',
    params: {}
  })
}

export function fetchMyNewsList(data) {
  return request({
    url: '/news/mylist',
    method: 'post',
    data
  })
}

// 对应接口的创建接口post create
export function createNews(data) {
  return request({
    url: '/news/addnews',
    method: 'post',
    data
  })
}

// 对应接口的更新接口put update
export function updateNews(data) {
  return request({
    url: `/news/editnews`,
    method: 'post',
    data
  })
}

// 对应接口的更新接口delete
export function deleteNews(data) {
  return request({
    url: `/news/delnews`,
    method: 'post',
    data
  })
}
